package com.sv.zgydor.dao.impl;

import com.sv.zgydor.dao.Table1DAO;
import com.sv.zgydor.pojo.pg.Table1Entity;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Class summary
 * User: kevin
 * Date: 2017/09/23
 * Time: 21:18
 * Description:
 */
@Repository
public class Table1DAOImpl extends BaseDAOImpl implements Table1DAO {

    @Override
    public void save(Table1Entity table1Entity) {
        Session s = this.pgDataSessionFactory.getCurrentSession();
        s.save(table1Entity);
    }

    @Override
    public List<Table1Entity> findAll() {
        return this.pgDataSessionFactory.getCurrentSession().createQuery("from Table1Entity t1").list();
    }
}
